using System;
using System.Data;
using System.Text;
using JHEMR.EmrSysDAL;
using JHEMR.EmrSysCom;
using JHEMR.EmrSysAdaper;

namespace JHEMR.EMREdit
{
    public sealed class EMREditHisAdaperJiahe : EMREditHisAdaper
    {
        public EMREditHisAdaperJiahe()
        {
            // 构造函数
        }
        
        #region 考勤数据提取窗口内容
        
        /// <summary>
        /// 截取字符串（处理中文字符）
        /// </summary>
        public static String bSubstring(string str, int len)
        {
            byte[] bytes = System.Text.Encoding.Unicode.GetBytes(str);
            int n = 0; // 表示当前的字节数
            int i = 0; // 要截取的字节数
            
            for (; i < bytes.GetLength(0) && n < len; i++)
            {
                // 偶数位置，如0、2、4等，为UCS2编码中两个字节的第一个字节
                if (i % 2 == 0)
                {
                    n++; // 在UCS2第一个字节时n加1
                }
                else
                {
                    // 当UCS2编码的第二个字节大于0时，该UCS2字符为汉字，一个汉字算两个字节
                    if (bytes[i] > 0)
                    {
                        n++;
                    }
                }
            }
            
            // 如果i为奇数时，处理成偶数
            if (i % 2 == 1)
            {
                // 该UCS2字符是汉字时，去掉这个截一半的汉字
                if (bytes[i] > 0)
                    i = i - 1;
                // 该UCS2字符是字母或数字，则保留该字符
                else
                    i = i + 1;
            }
            
            return System.Text.Encoding.Unicode.GetString(bytes, 0, i);
        }

        /// <summary>
        /// 读取护士执行的医嘱
        /// </summary>
        public DataSet getOrders(string strPatientID, int intVisitID)
        {
            DataSet objDataSet = EmrSysWebservices.EmrSysWebservicesUse.myEmrGetOrderDataSetByPatentID(strPatientID, intVisitID);
            return objDataSet;
        }

        /// <summary>
        /// 读取检验的主索引
        /// </summary>
        public DataSet getLabTestMaster(string strPatientID, int intVisitID, bool bCurVisit)
        {
            DataSet objDataSet = EmrSysWebservices.EmrSysWebservicesUse.myEmrGetLabDataSetByPatientID(strPatientID, intVisitID);
            return objDataSet;
        }

        /// <summary>
        /// 读取检验的主索引（重载）
        /// </summary>
        public DataSet getLabTestMaster(bool bCurVisit)
        {
            string strSQL;
            strSQL = "SELECT SUBJECT,RESULTS_RPT_DATE_TIME,SPECIMEN,TEST_NO,";
            strSQL += " RESULT_STATUS,REQUESTED_DATE_TIME,ORDERING_PROVIDER";
            strSQL += "   FROM LAB_TEST_MASTER ";
            strSQL += " WHERE PATIENT_ID ='" + EmrSysPubVar.getCurPatientID() + "' ";
            if (bCurVisit)
                strSQL += "  AND  VISIT_ID =  " + EmrSysPubVar.getCurPatientVisitID().ToString();
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 读取检验结果
        /// </summary>
        public string getLabResult(string strTestNo)
        {
            string strReturn = "";
            string strSQL;
            strSQL = "SELECT TEST_NO,ITEM_NO,TEST_NO,PRINT_ORDER,REPORT_ITEM_NAME,REPORT_ITEM_CODE,";
            strSQL += " RESULT,UNITS,RESULT_DATE_TIME,ABNORMAL_INDICATOR";
            strSQL += "   FROM LAB_RESULT ";
            strSQL += " WHERE TEST_NO ='" + strTestNo + "' ";
            strSQL += " ORDER BY PRINT_ORDER";
            
            DataSet objDataSet = new DataSet();
            objDataSet = DALUse.Query(strSQL);
            
            if (objDataSet.Tables.Count > 0)
            {
                DataTable objTable = objDataSet.Tables[0];
                string ls_creport_item_name, ls_cresult, ls_cabnormal_indicator, ls_cunits;
                
                foreach (DataRow drCurrent in objTable.Rows)
                {
                    ls_creport_item_name = drCurrent["REPORT_ITEM_NAME"].ToString();
                    ls_cresult = drCurrent["RESULT"].ToString();
                    ls_cabnormal_indicator = drCurrent["ABNORMAL_INDICATOR"].ToString();
                    ls_cunits = drCurrent["UNITS"].ToString();
                    
                    strReturn += ls_creport_item_name + "(" + ls_cresult + "," + ls_cunits + "," + ls_cabnormal_indicator + ");";
                }
            }
            return strReturn;
        }

        /// <summary>
        /// 读取数据篮医嘱
        /// </summary>
        public DataSet getBasketOrders()
        {
            string strSQL;
            strSQL += "   FROM ORDERS ";
            strSQL += " WHERE PATIENT_ID ='" + EmrSysPubVar.getCurPatientID() + "' ";
            strSQL += "  AND  VISIT_ID =  " + EmrSysPubVar.getCurPatientVisitID().ToString();
            strSQL += "  ORDER BY  START_DATE_TIME";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 读取医嘱类别名称
        /// </summary>
        public string getOrderClassName(string strOrderClassCode)
        {
            string strReturn = "其它";
            string strSQL;
            strSQL = "SELECT ORDER_CLASS_CODE,ORDER_CLASS_NAME,INPUT_CODE ";
            strSQL += "   FROM ORDER_CLASS_DICT ";
            strSQL += " WHERE ORDER_CLASS_CODE ='" + strOrderClassCode + "' ";
            strSQL += "  ORDER BY  ORDER_CLASS_CODE";
            
            DataSet objDataSet = DALUse.Query(strSQL);
            if (objDataSet != null && objDataSet.Tables.Count > 0)
            {
                DataTable objTable = objDataSet.Tables[0];
                if (objTable.Rows.Count > 0)
                {
                    DataRow drCurrent = objTable.Rows[0];
                    strReturn = drCurrent["ORDER_CLASS_NAME"].ToString();
                }
            }
            return strReturn;
        }

        /// <summary>
        /// 检查主索引
        /// </summary>
        public DataSet getExamMaster(bool bCurVisit)
        {
            string strSQL;
            strSQL = "SELECT EXAM_CLASS ,EXAM_SUB_CLASS,REPORT_DATE_TIME,EXAM_NO,EXAM_DATE_TIME,REQ_PHYSICIAN,REQ_DATE_TIME,REQ_DEPT,REPORTER,RESULT_STATUS,";
            strSQL += " PATIENT_ID,VISIT_ID";
            strSQL += "   FROM EXAM_APPOINTS ";
            strSQL += " WHERE EXAM_DATE_TIME is not null and PATIENT_ID ='" + EmrSysPubVar.getCurPatientID() + "' ";
            if (bCurVisit)
                strSQL += "  AND  VISIT_ID =  " + EmrSysPubVar.getCurPatientVisitID().ToString();
            strSQL += "   ORDER BY  EXAM_DATE_TIME";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 提取检查内容
        /// </summary>
        public string getExamResult(string strExamNo)
        {
            string strReturn = "";
            string strSQL;
            strSQL = "SELECT exam_para,description,impression,recommendation,is_abnormal,use_image";
            strSQL += "   FROM exam_report ";
            strSQL += " WHERE exam_no ='" + strExamNo + "' ";
            
            DataSet objDataSet = new DataSet();
            objDataSet = DALUse.Query(strSQL);
            
            if (objDataSet.Tables.Count > 0)
            {
                DataTable objTable = objDataSet.Tables[0];
                if (objTable.Rows.Count > 0)
                {
                    DataRow drCurrent = objTable.Rows[0];
                    strReturn += "\r\n" + "[检查参数]" + "\r\n" + drCurrent["exam_para"].ToString() + "\r\n";
                    strReturn += "[检查所见]" + "\r\n" + drCurrent["description"].ToString() + "\r\n";
                    strReturn += "[印象]" + "\r\n" + drCurrent["impression"].ToString() + "\r\n";
                    strReturn += "[建议]" + "\r\n" + drCurrent["recommendation"].ToString() + "\r\n";
                    if (drCurrent["is_abnormal"].ToString() == "1")
                        strReturn += "[异常]";
                }
            }
            return strReturn;
        }

        /// <summary>
        /// 提取患者的诊断记录
        /// </summary>
        public DataSet getPatDiagnose()
        {
            string strSQL;
            strSQL += " FROM PAT_DIAGNOSIS ";
            strSQL += " WHERE ( PATIENT_ID ='" + EmrSysPubVar.getCurPatientID() + "') ";
            strSQL += "   AND  ( VISIT_ID =" + EmrSysPubVar.getCurPatientVisitID().ToString() + ") ";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 提取患者的生命体征记录
        /// </summary>
        public DataSet getVitalSignsRec()
        {
            string strSQL;
            strSQL += " FROM VITAL_SIGNS_REC ";
            strSQL += " WHERE ( PATIENT_ID ='" + EmrSysPubVar.getCurPatientID() + "') ";
            strSQL += "   AND  ( VISIT_ID =" + EmrSysPubVar.getCurPatientVisitID().ToString() + ") ";
            strSQL += "   ORDER BY TIME_POINT DESC ";
            return DALUse.Query(strSQL);
        }
        #endregion

        #region 检查电子申请单
        
        /// <summary>
        /// 提取检查分类字典
        /// </summary>
        public DataSet getExamClassDict()
        {
            string strSQL;
            strSQL = "SELECT  EXAM_CLASS_CODE,EXAM_CLASS_NAME";
            strSQL += " FROM EXAM_CLASS_DICT ";
            strSQL += "   ORDER BY EXAM_CLASS_NAME ";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 提取检查子类字典
        /// </summary>
        public DataSet getExamSubClassDict(string strExamClassName)
        {
            string strSQL;
            strSQL = "SELECT  EXAM_SUBCLASS_NAME";
            strSQL += " FROM EXAM_SUBCLASS_DICT ";
            strSQL += " WHERE  EXAM_CLASS_NAME='" + strExamClassName + "'";
            strSQL += "   ORDER BY EXAM_SUBCLASS_NAME ";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 提取检查可选的详细项目
        /// </summary>
        public DataSet getExamRptPattern(string strExamClassName, string strExamSubClassName)
        {
            string strSQL;
            strSQL = "SELECT  DESCRIPTION,DESCRIPTION_CODE";
            strSQL += " FROM EXAM_RPT_PATTERN ";
            strSQL += " WHERE  EXAM_CLASS='" + strExamClassName + "' and EXAM_SUB_CLASS='" + strExamSubClassName + "' and DESC_ITEM = '检查项目'";
            strSQL += "   ORDER BY DESCRIPTION ";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 提取检查详细项目
        /// </summary>
        public DataSet getExamItems(string strExamNo)
        {
            string strSQL;
            strSQL = "SELECT  EXAM_ITEM";
            strSQL += " FROM EXAM_ITEMS ";
            strSQL += " WHERE  EXAM_NO='" + strExamNo + "'";
            strSQL += "   ORDER BY EXAM_ITEM ";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 检查预约主索引
        /// </summary>
        public DataSet getExamAppoint(bool bCurVisit)
        {
            string strSQL;
            strSQL = "SELECT EXAM_NO,EXAM_CLASS ,EXAM_SUB_CLASS,REQ_PHYSICIAN,PERFORMED_BY,REQ_DATE_TIME,REQ_DEPT";
            strSQL += "   FROM EXAM_APPOINTS ";
            strSQL += " WHERE PATIENT_ID ='" + EmrSysPubVar.getCurPatientID() + "' ";
            if (bCurVisit)
                strSQL += "  AND  VISIT_ID =  " + EmrSysPubVar.getCurPatientVisitID().ToString();
            strSQL += "   ORDER BY  REQ_DATE_TIME";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 提取检验科室字典
        /// </summary>
        public DataSet getLabDeptDict()
        {
            string strSQL;
            strSQL = "SELECT  DISTINCT a.PERFORMED_BY,b.DEPT_NAME";
            strSQL += " FROM LAB_SHEET_MASTER a,DEPT_DICT b ";
            strSQL += " WHERE a.PERFORMED_BY=b.DEPT_CODE";
            strSQL += "   ORDER BY DEPT_NAME ";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 提取检验定制检验单名称字典
        /// </summary>
        public DataSet getLabSheetMaster(string strDeptCode)
        {
            string strSQL;
            strSQL = "SELECT  LAB_SHEET_ID,SHEET_TITLE ";
            strSQL += " FROM LAB_SHEET_MASTER ";
            strSQL += " WHERE PERFORMED_BY='" + strDeptCode + "'";
            strSQL += "   ORDER BY SHEET_TITLE ";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 提取检验定制检验单名称条目字典
        /// </summary>
        public DataSet getLabSheetItems(string strSheetID)
        {
            string strSQL;
            strSQL = "SELECT  LAB_ITEM_NO,LAB_ITEM_CODE,LAB_ITEM_NAME ";
            strSQL += " FROM LAB_SHEET_ITEMS ";
            strSQL += " WHERE LAB_SHEET_ID='" + strSheetID + "'";
            strSQL += "   ORDER BY LAB_ITEM_NO ";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 提取指定检验的检验项目字典
        /// </summary>
        public DataSet getLabSpecimanDict(string strDeptCode)
        {
            string strSQL;
            strSQL = "SELECT  SPECIMAN_NAME,DEPT_CODE";
            strSQL += " FROM SPECIMAN_DICT ";
            strSQL += " WHERE DEPT_CODE='"+strDeptCode+"'";
            strSQL += "   ORDER BY SPECIMAN_NAME ";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 提取检验结果查询
        /// </summary>
        public DataSet getLabResultQuery(string strTestNo)
        {
            return EmrSysWebservices.EmrSysWebservicesUse.myEmrGetLabReportDataSet(strTestNo);
        }

        /// <summary>
        /// 提取检验项目结果查询
        /// </summary>
        public DataSet getLabItemResultQuery(string strPatientID, int intVisitID, string strReportItemCode)
        {
            return EmrSysWebservices.EmrSysWebservicesUse.myEmrGetLabItemResultQuery(strPatientID, intVisitID, strReportItemCode);
        }
        #endregion

        #region 电子处方
        
        /// <summary>
        /// 读取执行的医嘱
        /// </summary>
        public DataSet getOrders()
        {
            string strSQL;
            strSQL = "SELECT '' as REPEAT_INDICATOR_DISPLAY,REPEAT_INDICATOR,'' as ORDER_CLASS_DISPLAY,ORDER_CLASS,START_DATE_TIME,ORDER_TEXT,DOSAGE,DOSAGE_UNITS,ADMINISTRATION,DURATION,DURATION_UNITS,FREQUENCY,";
            strSQL += " STOP_DATE_TIME,FREQ_COUNTER,FREQ_INTERVAL,FREQ_INTERVAL_UNIT,DOCTOR,NURSE,STOP_DOCTOR,";
            strSQL += " ORDER_CODE,ORDER_STATUS,ENTER_DATE_TIME,FREQ_DETAIL,ORDER_NO,ORDER_SUB_NO,PERFORM_SCHEDULE,";
            strSQL += " BILLING_ATTR,LAST_ACCTING_DATE_TIME,PATIENT_ID,VISIT_ID ";
            strSQL += "   FROM ORDERS ";
            strSQL += " WHERE PATIENT_ID ='" + EmrSysPubVar.getCurPatientID() + "' ";
            strSQL += "  AND  VISIT_ID =  " + EmrSysPubVar.getCurPatientVisitID().ToString();
            strSQL += "  ORDER BY  ORDER_NO,ORDER_SUB_NO";
            
            DataSet objDataSet = DALUse.Query(strSQL);
            if (objDataSet != null && objDataSet.Tables.Count > 0)
            {
                DataTable objTable = objDataSet.Tables[0];
                for (int i = 0; i < objTable.Rows.Count; i++)
                {
                    DataRow drCurrent = objTable.Rows[i];
                    objTable.Rows[i]["REPEAT_INDICATOR_DISPLAY"] = (Convert.ToInt32(drCurrent["REPEAT_INDICATOR"].ToString()) == 1 ? "长" : "临");
                    objTable.Rows[i]["ORDER_CLASS_DISPLAY"] = getOrderClassName(drCurrent["ORDER_CLASS"].ToString());
                }
            }
            return objDataSet;
        }

        /// <summary>
        /// 读取医生的医嘱文本
        /// </summary>
        public DataSet getDoctorOrders()
        {
            string strSQL;
            strSQL = "SELECT REPEAT_INDICATOR,ORDER_CLASS,ORDER_TEXT,DOSAGE,DOSAGE_UNITS,ADMINISTRATION,FREQUENCY,FREQ_COUNTER,";
            strSQL += " FREQ_INTERVAL_UNIT,FREQ_INTERVAL,DURATION,DURATION_UNITS,FREQ_DETAIL,DOCTOR,NURSE,START_STOP_INDICATOR,";
            strSQL += " ORDER_CODE,ORDER_STATUS,ENTER_DATE_TIME,ORDER_NO,ORDER_SUB_NO,ORDERING_DEPT,ORDER_PRINT_INDICATOR,";
            strSQL += "  RELATED_ORDER_NO,RELATED_ORDER_SUB_NO,BILLING_ATTR,PROCESSING_DATE_TIME,START_DATE_TIME,DRUG_BILLING_ATTR,PATIENT_ID,VISIT_ID ";
            strSQL += "   FROM DOCTOR_ORDERS ";
            strSQL += " WHERE PATIENT_ID ='" + EmrSysPubVar.getCurPatientID() + "' ";
            strSQL += "  AND  VISIT_ID =  " + EmrSysPubVar.getCurPatientVisitID().ToString();
            strSQL += "  ORDER BY  ORDER_NO,ORDER_SUB_NO";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 读取套餐医嘱主索引
        /// </summary>
        public DataSet getGroupOrderMaster(string strDeptCode)
        {
            string strSQL;
            strSQL = "SELECT TITLE,GROUP_ORDER_ID,DEPT_CODE";
            strSQL += "   FROM GROUP_ORDER_MASTER ";
            if (strDeptCode.Length>0)
                strSQL += " WHERE DEPT_CODE ='" + strDeptCode + "' ";
            strSQL += "  ORDER BY  TITLE";
            return DALUse.Query(strSQL);
        }

        /// <summary>
        /// 读取套餐医嘱详细项目
        /// </summary>
        public DataSet getGroupOrderItems(string strGroupOrderID)
        {
            string strSQL;
            strSQL = "SELECT '' as REPEAT_INDICATOR_DISPLAY,'' as ORDER_CLASS_DISPLAY,GROUP_ORDER_ID,ITEM_NO,ITEM_SUB_NO,REPEAT_INDICATOR,ORDER_CLASS,ORDER_TEXT,";
            strSQL += "  ORDER_CODE,DOSAGE,DOSAGE_UNITS,ADMINISTRATION,FREQUENCY,FREQ_COUNTER,FREQ_INTERVAL,";
            strSQL += "  FREQ_INTERVAL_UNIT";
            strSQL += "   FROM GROUP_ORDER_ITEMS ";
            strSQL += " WHERE GROUP_ORDER_ID ='" + strGroupOrderID + "' ";
            strSQL += "  ORDER BY  ITEM_NO,ITEM_SUB_NO";
            
            DataSet objDataSet = DALUse.Query(strSQL);
            if (objDataSet != null && objDataSet.Tables.Count > 0)
            {
                DataTable objTable = objDataSet.Tables[0];
                for (int i = 0; i < objTable.Rows.Count; i++)
                {
                    DataRow drCurrent = objTable.Rows[i];
                    objTable.Rows[i]["REPEAT_INDICATOR_DISPLAY"] = (Convert.ToInt32(drCurrent["REPEAT_INDICATOR"].ToString()) == 1 ? "长" : "临");
                    objTable.Rows[i]["ORDER_CLASS_DISPLAY"] = getOrderClassName(drCurrent["ORDER_CLASS"].ToString());
                }
            }
            return objDataSet;
        }

        /// <summary>
        /// 读取医嘱途径字典
        /// </summary>
        public DataTable getAdministrationDict()
        {
            DataTable objTable = new DataTable();
            string strSQL;
            strSQL = "SELECT ADMINISTRATION_NAME,ADMINISTRATION_CODE,INPUT_CODE";
            strSQL += "   FROM ADMINISTRATION_DICT ";
            strSQL += "  ORDER BY  ADMINISTRATION_NAME";
            DataSet objDataSet = DALUse.Query(strSQL);
            if (objDataSet.Tables.Count > 0)
                objTable = objDataSet.Tables[0];
            return objTable;
        }

        /// <summary>
        /// 读取医嘱单位字典
        /// </summary>
        public DataTable getDosageUnitsDict()
        {
            DataTable objTable = new DataTable();
            string strSQL;
            strSQL = "SELECT DOSAGE_UNITS,BASE_UNITS,CONVERSION_RATIO,INPUT_CODE";
            strSQL += "   FROM DOSAGE_UNITS_DICT ";
            strSQL += "  ORDER BY  DOSAGE_UNITS";
            DataSet objDataSet = DALUse.Query(strSQL);
            if (objDataSet.Tables.Count > 0)
                objTable = objDataSet.Tables[0];
            return objTable;
        }

        /// <summary>
        /// 读取医嘱频次字典
        /// </summary>
        public DataTable getPerformFreqDict(string strFreqDesc)
        {
            DataTable objTable = new DataTable();
            string strSQL;
            strSQL = "SELECT FREQ_DESC,FREQ_COUNTER,FREQ_INTERVAL,FREQ_INTERVAL_UNITS";
            strSQL += "   FROM PERFORM_FREQ_DICT ";
            if (strFreqDesc.Length>0)
                strSQL += "  WHERE  FREQ_DESC='" + strFreqDesc+"' ";
            strSQL += "  ORDER BY  FREQ_DESC";
            DataSet objDataSet = DALUse.Query(strSQL);
            if (objDataSet.Tables.Count > 0)
                objTable = objDataSet.Tables[0];
            return objTable;
        }

        /// <summary>
        /// 读取药品字典
        /// </summary>
        public DataTable getDrugDict(string strDrugCode)
        {
            DataTable objTable = new DataTable();
            string strSQL;
            strSQL = "SELECT DRUG_CODE,DRUG_NAME,DRUG_SPEC,UNITS,DRUG_FORM,TOXI_PROPERTY,DOSE_PER_UNIT,DOSE_UNITS,DRUG_INDICATOR,INPUT_CODE";
            strSQL += "   FROM DRUG_DICT ";
            if (strDrugCode.Length > 0)
                strSQL += "  WHERE  DRUG_CODE='" + strDrugCode + "' ";
            strSQL += "  ORDER BY  DRUG_CODE";
            DataSet objDataSet = DALUse.Query(strSQL);
            if (objDataSet.Tables.Count > 0)
                objTable = objDataSet.Tables[0];
            return objTable;
        }

        /// <summary>
        /// 读取医嘱状态字典
        /// </summary>
        public string getOrderStatusDict(string strOrderStatusCode)
        {
            string strReturn = "";
            string strSQL;
            strSQL = "SELECT ORDER_STATUS_CODE,ORDER_STATUS_NAME,INPUT_CODE ";
            strSQL += "   FROM ORDER_STATUS_DICT ";
            strSQL += " WHERE ORDER_STATUS_CODE ='" + strOrderStatusCode + "' ";
            
            DataSet objDataSet = DALUse.Query(strSQL);
            if (objDataSet != null && objDataSet.Tables.Count > 0)
            {
                DataTable objTable = objDataSet.Tables[0];
                if (objTable.Rows.Count > 0)
                {
                    DataRow drCurrent = objTable.Rows[0];
                    strReturn = drCurrent["ORDER_STATUS_NAME"].ToString();
                }
            }
            return strReturn;
        }

        /// <summary>
        /// 读取医嘱类别字典
        /// </summary>
        public DataTable getOrderClassDict()
        {
            DataTable objTable = new DataTable();
            string strSQL;
            strSQL = "SELECT ORDER_CLASS_CODE,ORDER_CLASS_NAME,INPUT_CODE ";
            strSQL += "   FROM ORDER_CLASS_DICT ";
            strSQL += "  ORDER BY  ORDER_CLASS_CODE";
            DataSet objDataSet = DALUse.Query(strSQL);
            if (objDataSet.Tables.Count > 0)
                objTable = objDataSet.Tables[0];
            return objTable;
        }

        /// <summary>
        /// 读取医嘱重复指示器字典
        /// </summary>
        public DataTable getOrderRepearIndicator()
        {
            DataTable objTable = new DataTable();
            string strSQL;
            strSQL = "SELECT REPEAT_INDICATOR,REPEAT_INDICATOR_NAME ";
            strSQL += "   FROM REPEAT_INDICATOR_DICT ";
            strSQL += "  ORDER BY  REPEAT_INDICATOR";
            DataSet objDataSet = DALUse.Query(strSQL);
            if (objDataSet.Tables.Count > 0)
                objTable = objDataSet.Tables[0];
            return objTable;
        }
        #endregion
    }
}